﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeBehind="Salary_Emp.aspx.cs" Inherits="UdrinkWater_Project.Officer.Salary_Emp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" 
        HeaderText="รายงานเงินเดือน" Width="100%">
        <HeaderStyle Font-Size="Medium" HorizontalAlign="Left" />
        <PanelCollection>
<dx:PanelContent runat="server" SupportsDisabledAttribute="True">
    <dx:ASPxPivotGrid ID="PivotGrid_Salary" runat="server" ClientIDMode="AutoID" 
        DataSourceID="SqlData_Salary" TotalsVisibility="CustomTotals" Width="100%">
        <Fields>
            <dx:PivotGridField ID="fieldEmployee" AreaIndex="1" Caption="พนักงาน" 
                FieldName="Employee">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldSalary" AreaIndex="0" FieldName="Salary">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldSalaryStart" Area="RowArea" AreaIndex="0" 
                Caption="ประจำเดือน" FieldName="Salary_Start" GroupInterval="DateMonth" 
                UnboundFieldName="fieldSalaryStart">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldSalaryEnd" Area="ColumnArea" AreaIndex="0" 
                Caption="ประจำปี" FieldName="Salary_End" GroupInterval="DateYear" 
                UnboundFieldName="fieldSalaryEnd">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldSalaryOT" Area="DataArea" AreaIndex="0" 
                Caption="เงินล่วงเวลา" FieldName="Salary_OT">
                <CellStyle HorizontalAlign="Center">
                    <Paddings PaddingLeft="40px" PaddingRight="40px" />
                </CellStyle>
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldSalaryAbsence" Area="DataArea" AreaIndex="2" 
                Caption="ค่าปรับขาดงาน" FieldName="Salary_Absence">
                <CellStyle HorizontalAlign="Center">
                    <Paddings PaddingLeft="40px" PaddingRight="40px" />
                </CellStyle>
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldSalaryWithDraw" Area="DataArea" AreaIndex="3" 
                Caption="เบิกล่วงหน้า" FieldName="Salary_WithDraw">
                <CellStyle HorizontalAlign="Center">
                    <Paddings PaddingLeft="40px" PaddingRight="40px" />
                </CellStyle>
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldSalaryOther" Area="DataArea" AreaIndex="4" 
                Caption="อื่นๆ" FieldName="Salary_Other">
                <CellStyle HorizontalAlign="Center">
                    <Paddings PaddingLeft="40px" PaddingRight="40px" />
                </CellStyle>
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldSalaryCommission" Area="DataArea" AreaIndex="1" 
                Caption="ค่าคอมมิชชั่น" FieldName="Salary_Commission">
                <CellStyle HorizontalAlign="Center">
                    <Paddings PaddingLeft="40px" PaddingRight="40px" />
                </CellStyle>
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldTotal" Area="DataArea" AreaIndex="5" 
                Caption="เงินเดือนสุทธิ" FieldName="Total">
                <CellStyle HorizontalAlign="Center">
                    <Paddings PaddingLeft="40px" PaddingRight="40px" />
                </CellStyle>
            </dx:PivotGridField>
        </Fields>
        <OptionsView ShowDataHeaders="False" ShowFilterHeaders="False" />
        <OptionsCustomization AllowSortBySummary="False" />
        <OptionsData AutoExpandGroups="True" />
        <OptionsFilter NativeCheckBoxes="False" />
        <StylesPrint Cell-BackColor2="" Cell-GradientMode="Horizontal" 
            CustomTotalCell-BackColor2="" CustomTotalCell-GradientMode="Horizontal" 
            FieldHeader-BackColor2="" FieldHeader-GradientMode="Horizontal" 
            FieldValue-BackColor2="" FieldValue-GradientMode="Horizontal" 
            FieldValueGrandTotal-BackColor2="" 
            FieldValueGrandTotal-GradientMode="Horizontal" FieldValueTotal-BackColor2="" 
            FieldValueTotal-GradientMode="Horizontal" GrandTotalCell-BackColor2="" 
            GrandTotalCell-GradientMode="Horizontal" Lines-BackColor2="" 
            Lines-GradientMode="Horizontal" TotalCell-BackColor2="" 
            TotalCell-GradientMode="Horizontal" />
    </dx:ASPxPivotGrid>
    <asp:SqlDataSource ID="SqlData_Salary" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" SelectCommand="SELECT TB_Employee.ID_Card + '  ' + TB_Employee.Firstname AS Employee, 
TB_Employee.Salary, TB_Salary.Salary_Start, TB_Salary.Salary_End, TB_Salary.Salary_OT, TB_Salary.Salary_Absence, 
TB_Salary.Salary_WithDraw, TB_Salary.Salary_Other, TB_Salary.Salary_Commission,
((TB_Employee.Salary+TB_Salary.Salary_OT+TB_Salary.Salary_Commission)-(TB_Salary.Salary_Absence+TB_Salary.Salary_WithDraw+TB_Salary.Salary_Other)) AS Total
FROM TB_Employee INNER JOIN TB_Salary ON TB_Employee.ID_Card = TB_Salary.Employee_ID
WHERE TB_Employee.ID_Card=@ID_Card">
        <SelectParameters>
            <asp:SessionParameter Name="ID_Card" SessionField="ID_Card" />
        </SelectParameters>
    </asp:SqlDataSource>
            </dx:PanelContent>
</PanelCollection>
    </dx:ASPxRoundPanel>
</asp:Content>
